//
//  PicPickerCollectionCell.swift
//  WBSwift
//
//  Created by maker on 2016/11/19.
//  Copyright © 2016年 maker. All rights reserved.
//

import UIKit

class PicPickerCollectionCell: UICollectionViewCell {
    @IBOutlet weak var imageBtn: UIButton!
    @IBOutlet weak var cancelBtn: UIButton!
    @IBOutlet weak var iv: UIImageView!
    
    var image : UIImage?{
        didSet{
            if image == nil {
                iv.image = nil
                imageBtn.isUserInteractionEnabled = true
                cancelBtn.isHidden = true
            }else{
                iv.image = image
                imageBtn.isUserInteractionEnabled = false
                cancelBtn.isHidden = false
            }
        }
    }
    

    override func awakeFromNib() {
        super.awakeFromNib()

    }


    @IBAction func btnClick(_ sender: UIButton) {
        NotificationCenter.default.post(name: Notification.Name(rawValue: AddPhotoNotice), object: nil)
    }
    @IBAction func cancelClick(_ sender: UIButton) {
        NotificationCenter.default.post(name: Notification.Name(rawValue: RemovePhotoNotice), object: image)
    }

}
